package com.hut.oa.model.bean;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.springframework.format.annotation.DateTimeFormat;


/**
 * 评价表
 * @author zdd
 *
 */
@Entity
@Table(name="discuss_comment")
public class DiscussComment {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="dc_id")
	private Long id;//评价id
	
	@Column(name="dc_content")
	private String content;//评价内容
	
	@Column(name="dc_time")
	private Date time=new Date();//评价时间
	
	@Column(name="dc_thumb_num")
	private Integer thumbNum=0;//点赞数
	
	@Column(name="dc_reply_num")
	private Integer replyNum=0;//回复数
	
	@OneToOne  
	@JoinColumn(name="dc_user_id")
	private User user;//评价用户

	@ManyToOne()
	@JoinColumn(name="da_id")
	private DiscussArea discuss;//对应一个帖子
	
	@OneToMany(mappedBy="comment",fetch=FetchType.LAZY,cascade=CascadeType.REMOVE)
	private List<CommentReply> replys;//对应多个回复
	
	@OneToMany(mappedBy="comment",fetch=FetchType.LAZY,cascade=CascadeType.REMOVE)
	private List<CommentThumbs> thumbs;//对应多个点赞
	
	public DiscussArea getDiscuss() {
		return discuss;
	}

	public void setDiscuss(DiscussArea discuss) {
		this.discuss = discuss;
	}

	public DiscussComment() {}
	

	public Integer getThumbNum() {
		return thumbNum;
	}

	public void setThumbNum(Integer thumbNum) {
		this.thumbNum = thumbNum;
	}

	public Integer getReplyNum() {
		return replyNum;
	}

	public void setReplyNum(Integer replyNum) {
		this.replyNum = replyNum;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}
	
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public List<CommentReply> getReplys() {
		return replys;
	}

	public void setReplys(List<CommentReply> replys) {
		this.replys = replys;
	}

	public List<CommentThumbs> getThumbs() {
		return thumbs;
	}

	public void setThumbs(List<CommentThumbs> thumbs) {
		this.thumbs = thumbs;
	}

	@Override
	public String toString() {
		return "DiscussComment [id=" + id + ", content=" + content + ", time=" + time + ", thumbNum=" + thumbNum
				+ ", replyNum=" + replyNum + "]";
	}

}
